home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Day Cry
/
Day Cry CD.bin
/
oh_towns
/
taropyon
/
he386
/
ccisrc
/
gmega.c
< prev
next >
Wrap
Text File
|
1994-09-20
|
6KB
|
229 lines
/*************************************************************************
* for KAWAI GMega
*************************************************************************/
int GMegaUnitRcvCh = 0x00;
int GMega_macroInit( char *sqr )
{
GMegaUnitRcvCh = 0x00;
/* â}âNâìû╝ CCI è╓Éöû╝ */
MMac_extDefine( sqr, "GMega_setUnitRcvCh" , "GMega_setUnitRcvCh" , MMAC_ATT_EXT, NULL );
MMac_extDefine( sqr, "exGMega_system" , "exGMega_system" , MMAC_ATT_EXT, NULL );
MMac_extDefine( sqr, "exGMega_section" , "exGMega_section" , MMAC_ATT_EXT, NULL );
MMac_extDefine( sqr, "exGMega_single" , "exGMega_single" , MMAC_ATT_EXT, NULL );
MMac_extDefine( sqr, "exGMega_percussion" , "exGMega_percussion" , MMAC_ATT_EXT, NULL );
MMac_extDefine( sqr, "_GMEGA_MACRO_DEFINED", "" , MMAC_ATT_NORMAL , NULL );
return (NORMAL);
}
/*************************************************************************
* $GMega_setUnitRcvCh(ch)
* ch 1ü`16
*************************************************************************/
int GMega_setUnitRcvCh( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
int ch;
if ( argc < 1 )
{
_ERR: MM_setErrMsg(sqr,"GMega system exclusive error! (unit receive channel)");
return (ERR);
}
ch = atoi(argv[0]) - 1;
if ( ch < 0 || ch > 15 )
goto _ERR;
GMegaUnitRcvCh = ch;
return (0);
}
/*************************************************************************
* exGMega_system(no,data) : system function
* no üc function no. (dec)
* data üc data (dec)
*************************************************************************/
int exGMega_system( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char excl[32], tmp[256];
unsigned siz;
int no, dat;
if ( argc < 2 )
{
MM_setErrMsg(sqr,"GMega system exclusive error! (system function)");
return (ERR);
}
no = atoi(argv[0]);
dat = atoi(argv[1]);
excl[ 0] = 0xF0;
excl[ 1] = 0x40;
excl[ 2] = GMegaUnitRcvCh;
excl[ 3] = 0x10;
excl[ 4] = 0x00;
excl[ 5] = 0x08;
excl[ 6] = 0x00;
excl[ 7] = no;
excl[ 8] = 0x00;
excl[ 9] = (dat>>4) & 0x0F;
excl[10] = dat & 0x0F;
excl[11] = 0xF7;
siz = 12;
siz = make_sysEx(tmp, siz, excl );
if ( siz >= bufSiz )
{
MM_setErrMsg(sqr,_OUT_OF_STRING_SPACE);
return (ERR);
}
memcpy( buf, tmp, siz );
return (siz);
}
/*************************************************************************
* exGMega_section(no,sec,data) : section function
* no üc function no. (dec)
* sec üc section no (dec.1ü`32)
* data üc data (dec)
*************************************************************************/
int exGMega_section( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char excl[32], tmp[256];
unsigned siz;
int no, sec, dat;
if ( argc < 3 )
{
_ERR:
MM_setErrMsg(sqr,"GMega system exclusive error! (section function)");
return (ERR);
}
no = atoi(argv[0]);
sec = atoi(argv[1]) - 1;
dat = atoi(argv[2]);
if ( sec < 0 || sec > 31 )
goto _ERR;
excl[ 0] = 0xF0;
excl[ 1] = 0x40;
excl[ 2] = GMegaUnitRcvCh;
excl[ 3] = 0x10;
excl[ 4] = 0x00;
excl[ 5] = 0x08;
excl[ 6] = 0x01;
excl[ 7] = no;
excl[ 8] = sec;
excl[ 9] = (dat>>4) & 0x0F;
excl[10] = dat & 0x0F;
excl[11] = 0xF7;
siz = 12;
siz = make_sysEx(tmp, siz, excl );
if ( siz >= bufSiz )
{
MM_setErrMsg(sqr,_OUT_OF_STRING_SPACE);
return (ERR);
}
memcpy( buf, tmp, siz );
return (siz);
}
/*************************************************************************
* exGMega_single(no,sub,data1,data2) : single function
* no üc function no. (dec)
* sub üc single no. (dec 1ü`128)
* data1 üc data1 (dec)
* data2 üc data2 (dec)
*************************************************************************/
int exGMega_single( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char excl[32], tmp[256];
unsigned siz;
int no, sub, dat1, dat2;
if ( argc < 4 )
{
_ERR:
MM_setErrMsg(sqr,"GMega system exclusive error! (single function)");
return (ERR);
}
no = atoi(argv[0]);
sub = atoi(argv[1]) - 1;
dat1 = atoi(argv[2]);
dat2 = atoi(argv[3]);
if ( sub < 0 || sub > 127 )
goto _ERR;
excl[ 0] = 0xF0;
excl[ 1] = 0x40;
excl[ 2] = GMegaUnitRcvCh;
excl[ 3] = 0x10;
excl[ 4] = 0x00;
excl[ 5] = 0x08;
excl[ 6] = 0x03;
excl[ 7] = no;
excl[ 8] = sub;
excl[ 9] = (dat1>>4) & 0x0F;
excl[10] = dat1 & 0x0F;
excl[11] = (dat2>>4) & 0x0F;
excl[12] = dat2 & 0x0F;
excl[13] = 0xF7;
siz = 14;
siz = make_sysEx(tmp, siz, excl );
if ( siz >= bufSiz )
{
MM_setErrMsg(sqr,_OUT_OF_STRING_SPACE);
return (ERR);
}
memcpy( buf, tmp, siz );
return (siz);
}
/*************************************************************************
* exGMega_percussion(no,sub,data)
* no üc function no. (dec)
* sub üc percussion no. (dec 0ü`127)
* data üc data (dec)
*************************************************************************/
int exGMega_percussion( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char excl[32], tmp[256];
unsigned siz;
int no, sub, dat;
if ( argc < 3 )
{
_ERR:
MM_setErrMsg(sqr,"GMega system exclusive error! (percussion function)");
return (ERR);
}
no = atoi(argv[0]);
sub = atoi(argv[1]);
dat = atoi(argv[2]);
excl[ 0] = 0xF0;
excl[ 1] = 0x40;
excl[ 2] = GMegaUnitRcvCh;
excl[ 3] = 0x10;
excl[ 4] = 0x00;
excl[ 5] = 0x08;
excl[ 6] = 0x04;
excl[ 7] = no;
excl[ 8] = sub;
excl[ 9] = (dat>>4) & 0x0F;
excl[10] = dat & 0x0F;
excl[11] = 0xF7;
siz = 12;
siz = make_sysEx(tmp, siz, excl );
if ( siz >= bufSiz )
{
MM_setErrMsg(sqr,_OUT_OF_STRING_SPACE);
return (ERR);
}
memcpy( buf, tmp, siz );
return (siz);
}